#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define		SIZE	50

void reverse_string(char *string);

int
main()
{
	char str[SIZE];

	do {
		memset(str, 0, sizeof(str));

		printf("Please input your string:");
		scanf("%s", str);

		reverse_string(str);

		printf("After Reverse :%s\n", str);
	}while(str != NULL);

	return 0;
}

void reverse_string(char *string)
{
	assert(string != NULL);

	char *head , *tail;
	char tmp;
	int len = strlen(string);

	head = string; 
	tail = head + (len - 1);

	int i = 1;
	len /= 2;
	while(i <= len) {
		if (head != tail) {
			tmp = *head;
			*head = *tail;
			*tail = tmp;
		}
		i++;
		head++;
		tail--;
	}
}